home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / SAT / HeartQuest sample ƒ / sPoints.p < prev   
Encoding:
Text File  |  1993-09-19  |  1.4 KB  |  59 lines  |  [TEXT/PJMM]

  1. {===============================================}
  2. {================= Point sprite unit ================}
  3. {===============================================}
  4.  
  5. { Example file for Ingemars Sprite Animation Toolkit. }
  6. { © Ingemar Ragnemalm 1992 }
  7. { See doc files for legal terms for using this code. }
  8.  
  9. unit sPoints;
  10.  
  11. { Sprite unit. A Sprite unit should include the following routines:}
  12. { Init-procedure, that initializes private bitmaps}
  13. { Setup-procedure, that sets variables other than the standard ones set by MakeSprite }
  14. { Handle-procedure, to be called once per iteration until the sprite dies }
  15. { Hittask-procedure (optional), for advanced collission handling. }
  16.  
  17. { This object is a non-moving, flashing number, used to indicate that the player}
  18. { has caught a bonus object. }
  19.  
  20. interface
  21.  
  22.     uses
  23.         SAT, GameGlobals;
  24.  
  25.     procedure InitPoints;
  26.     procedure SetupPoints (mp: SpritePtr);
  27.     procedure HandlePoints (me: SpritePtr);
  28.  
  29. implementation
  30.  
  31.     var
  32.         PointsFace, fPointsFace: FacePtr;
  33.  
  34.     procedure InitPoints;
  35.         var
  36.             h: Handle;
  37.     begin
  38.         fPointsFace := GetFace(132);
  39.         PointsFace := GetFace(131);
  40.     end;
  41.  
  42.     procedure SetupPoints (mp: SpritePtr);
  43.     begin
  44.         mp^.face := PointsFace;
  45.     end;
  46.  
  47.     procedure HandlePoints (me: SpritePtr);
  48.     begin
  49.         me^.mode := me^.mode + 1;
  50.         if (me^.mode > 32) or (band(me^.mode, 8) = 0) then
  51.             me^.face := PointsFace
  52.         else
  53.             me^.face := fPointsFace;
  54.  
  55.         if me^.mode > 60 then
  56.             me^.task := nil;
  57.     end;
  58.  
  59. end.